package com.wctj.api.business.common.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wctj.api.base.entity.DdwxPaymentMessageInfo;
import com.wctj.api.base.utils.InstanceConvertUtil;
import com.wctj.api.business.common.dto.DdwxPaymentMessageInfoDTO;
import com.wctj.api.business.common.service.DdwxPaymentMessageInfoService;
import com.wctj.api.business.common.dao.DdwxPaymentMessageInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DdwxPaymentMessageInfoServiceImpl extends ServiceImpl<DdwxPaymentMessageInfoMapper, DdwxPaymentMessageInfo> implements DdwxPaymentMessageInfoService {

    @Override
    public DdwxPaymentMessageInfoDTO findByPayOrderNumber(String orderNo) {
        DdwxPaymentMessageInfo record = new LambdaQueryChainWrapper<>(baseMapper)
                .eq(DdwxPaymentMessageInfo::getPayOrderNum, orderNo)
                .one();
        return InstanceConvertUtil.convertObject(record, DdwxPaymentMessageInfoDTO.class);
    }

    @Override
    public void updateById(DdwxPaymentMessageInfoDTO ddwxPaymentMessageInfoDTO) {
        Boolean updateBool = this.updateById(InstanceConvertUtil.convertObject(ddwxPaymentMessageInfoDTO, DdwxPaymentMessageInfo.class));
        log.info("updateById(ddwxPaymentMessageInfoDTO) effect：{}", updateBool);
    }



}
